package com.jacky.iot.resources;

import org.eclipse.californium.core.CoapResource;
import org.eclipse.californium.core.coap.Request;
import org.eclipse.californium.core.network.Exchange;
import org.eclipse.californium.core.server.resources.CoapExchange;

public class ApiV1Resource extends AbstractCoapResource {

    public ApiV1Resource(String name) {
        super(name);
    }

    @Override
    protected void processGetRequest(CoapExchange exchange) {
        Request request = exchange.advanced().getRequest();
        request.getType();
        System.out.println("api get uri:" + exchange.advanced().getRequest().getURI());
        exchange.respond("25.3");
    }

    @Override
    protected void processPostRequest(CoapExchange exchange) {
        System.out.println("api post uri:" + exchange.advanced().getRequest().getURI());
        exchange.respond("26.3");
    }

}
